use "dataset_representation", clear

gen vot_statewide = 1 if yespct > 0.5 
replace vot_statewide = 0 if yespct < 0.5

gen cong_statewide = rep_ == vot_statewide
replace cong_statewide = . if mi(rep)

encode official_g, gen(x)

gen b = .

forvalues i = 1(1)4 {
	reg cong_statewide if x == `i'
 	replace b = _b[_cons] if x == `i' 
}

collapse b, by(x)

#delimit;

gr tw
	(sc b x, col(black))
	,
		legend(off)
		yline(0.5, lpat(dash))
		plotregion(style(none))
		ylab(0(0.25)1, angle(horiz))
		xtitle("")
		ytitle("Proportion congruent positions")
		xsize(3) ysize(2)
		xlab(
			1 "DA's"
			2 "Local officials"
			3 "State legislators"
			4 "US House members"
		)
		xscale(range(0.75 4.25))
		;

#delimit cr

gr export "_output/figure A1.pdf", replace
